import axiosInstance from '@/utils/request'
import axiosMockInstance from '@/utils/requestMock'
import type{IResponse} from '@/types/types'


/**
 * 产品列表
 *   shopKey: 店铺名称
 *   productKey: 产品名称
 * @returns 
 */
export const RequestShopList = (pageNo:number,pageSize:number):Promise<IResponse>=>{
    return axiosInstance({
        method:'get',
        url:'/api/shop',
        params:{
            pageSize,
            pageNo,
        }
    })
}

/**
 * 轮播
 */
export const RequestBanner = ():Promise<IResponse>=>{
    return axiosInstance({
        method:'get',
        url:'/api/banner'
    })
}


/**
 * 登录
 */
export const RequestLogin = (username:string,password:string):Promise<IResponse>=>{
    return axiosMockInstance({
        method:'post',
        // url:'/api/member/login',
        url:'/mock/account/login',
        data:{
            username,
            password
        }
    })
}

/**
 * 注册
 */
export const RequestRegister = (username:string,password:string,headerimg:string):Promise<IResponse>=>{
    return axiosMockInstance({
        method:'post',
        url:'/mock/account/register',
        data:{
            username,
            password,
            headerimg
        }
    })
}